package com.fzz.learnitservice.pojo.po;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fzz.learnitservice.pojo.enums.EnglishLevelEnum;
import com.fzz.learnitservice.pojo.enums.GenderEnum;
import com.fzz.learnitservice.pojo.enums.UserStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 用户信息表
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("user")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.INPUT)
    private Long id;

    private String username;

    /** 英语水平 */
    @EnumValue
    private EnglishLevelEnum englishLevel;

    private String email;

    private String avatarUrl;

    private String password;

    /** 性别（0：女，1：男，2：未知） */
    @EnumValue
    private GenderEnum sex;

    /** 出生日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate birthday;

    private String school;

    private String personIntroduction;

    /** 加入时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime joinTime;

    /** 最新登录时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastLoginTime;

    /** 状态（0：禁用，1：正常，2：已删除） */
    @EnumValue
    private UserStatusEnum status;

    private String noticeInfo;

    private String phone;

    private Integer points;
}
